package com.bw.eurekamongodb.controller;


import com.bw.common.dto.LogDto;
import com.bw.common.vo.ResultVO;
import com.bw.eurekamongodb.entity.LogEntity;
import com.bw.eurekamongodb.service.LogService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogController {

    @Autowired
    LogService logService;

    @RequestMapping("/log/find/page")
    public ResultVO findLogPage(LogDto logDto){
       return logService.findLogPage(logDto);
    }

    @RequestMapping("/log/save")
    public ResultVO saveLog(@RequestBody LogDto logDto){
        LogEntity logEntity = new LogEntity();
        BeanUtils.copyProperties(logDto,logEntity);
        logService.saveLog(logEntity);
        return ResultVO.success();
    }



}
